<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
        <title>WIFI信息查询</title>
        
        <link rel="stylesheet" type="text/css" href="../css/cm-default.css"  />
        <link rel="stylesheet" type="text/css" href="../ligerUI/skins/Aqua/css/ligerui-all.css" />
        <link rel="stylesheet" type="text/css" href="../ligerUI/skins/ligerui-icons.css" />
        <script src="../js/jquery-min.js" type="text/javascript"></script>
        <script src="../ligerUI/js/ligerui.min.js" type="text/javascript"></script>
        <script src="../js/common.js" type="text/javascript"></script>
        <script src="../js/json2.js" type="text/javascript"></script>
        <script type="text/javascript">
            var defGrid;
            $(function(){
                var opt = window.location.toString().replace(/^[^?]+\?o=/, ''); 
                defGrid = $("#query_list").ligerGrid({
                    columns:[
                             {display:'WIFI编号',name:'wifi_no',width:130,align:'left'},
                             {display:'WIFI名称(ssid)',name:'wifi_ssid',width:100,align:'left'},
                             {display:'商户编号',name:'shop_no',width:130,align:'left'},
                             {display:'商户名称',name:'shop_name',width:150,align:'left'},
                    ],
                    pageSize:10,
                    usePager: true,
                    width:'100%',
                    height:'99%',
                    dataAction:'server',
                    checkbox:false,
                    rownumbers:false,
                    fixedCellHeight:false,
                    colDraggable:true,
                    enabledEdit:true,
                    clickToEdit:false,
                    onSelectRow:function(rowdata, rowindex){$("#txtrowindex").val(rowindex);},
                    url: '../common/q.jsp',
                    onToFirst: function(item) {
                        toQuery(item, 1);
                    },
                    onToLast: function(item) {
                        var p = parseInt(defGrid.options.total / defGrid.options.pageSize);
                        if (defGrid.options.total % defGrid.options.pageSize > 0)
                            p += 1;
                        toQuery(item, p);
                    },
                    onToPrev: function(item) {
                        var p = parseInt(defGrid.options.page);
                        if (p > 1)
                            p -= 1;
                        else
                            return;
                        toQuery(item, p);
                    },
                    onToNext: function(item) {
                        var p = parseInt(defGrid.options.total / defGrid.options.pageSize);
                        if (defGrid.options.total % defGrid.options.pageSize > 0)
                            p += 1;
                        var cp = parseInt(defGrid.options.page); 
                        if (cp < p)
                            cp += 1;
                        toQuery(item, cp);
                    }
                });
                $("#pageloading").hide();
                //默认查询全部数据 
                toQuery();
            });
            
            function toQuery(item, page, pageSize) {
                if (!page)
                    page = defGrid.options.page;
                if (!pageSize)
                    pageSize = defGrid.options.pageSize;
                
                var param = new Object();
                param.code=$("#codeQ").val();
                param.name = $("#nameQ").val();
                var data = JSON.stringify(reqObj('q','wifi.select.wifi_shop.select',JSON.stringify(param),'l',true,page,pageSize));
                ajaxSubmit("/cmwifi/rbac/cm.do?m=q", data, function(data) {
                    var d = data['data'].Rows;
                    var ps = defGrid.options.pageSize, p = defGrid.options.page, t = parseInt(data['data'].Total);
                    if (t > ps) {
                        for (var i = 0; i < (p - 1) * ps; i++) {
                            d.unshift(null);
                        }
                    }
                    defGrid.data = data['data'];
                    defGrid.set({data: data['data']});
                },null,true);
            }
            function getSelectedRow() {
                return defGrid.getSelectedRow();
            }
        </script>
        <style type="text/css">
            label{margin: 5px 20px 5px 15px;}
            .fields{height:35px;padding-top:5px;}
            .dict-info{width: 260px;padding: 10px;}
            .diff {margin:3px 0;}
            .lineD {width:99%;float:left;position:relative;overflow:hidden;margin:10px 0 2px 2px}
            .labelD {width:13%;position:relative;float:left;padding-top:3px;}
            .dplD {width:36%;position:relative;float:left;}
            .title{font-size:14px;font-weight:bold;background-position:left;padding-left:18px;}
            .l-dialog-content-nopadding{padding:0 !important;}
        </style>
    </head>
    <body style="padding:0;">
        <div id="pageloading"></div>  
        <div id="layout_main">
            <div position="center" id="a_center" title="WIFI商户列表">
                <div id="query_cond" class="fields">
                    <label>WIFI名称</label><input type="text" class="s-text-sort txt-def" id="wifi_ssidQ" />
                    <label>商户名称</label><input type="text" class="s-text-sort txt-def" id="shop_nameQ" />
                    <input type="button" value="查询" style="margin-left:25px;" onclick="toQuery();" />
                    <input type="button" value="清空" onclick="toReset('#wifi_ssidQ,#shop_nameQ,');" />
                </div>
                <div id="query_list"></div>
            </div>
        </div>
    </body>
</html>